efi_loader: initialize device path on alloc
authorPatrick Wildt <[email protected]>
Sun, 25 Mar 2018 17:54:03 +0000 (19:54 +0200)
committerAlexander Graf <[email protected]>
Wed, 4 Apr 2018 09:22:35 +0000 (11:22 +0200)
Since the backing memory for a new device path can contain stale
data we have to make sure that we zero the buffer.  Otherwise some
code paths that don't set all fields in a structure backed by this
device path might contain unwanted stale data.

Signed-off-by: Patrick Wildt <[email protected]>
Reviewed-by: Heinrich Schuchardt <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
lib/efi_loader/efi_device_path.c

index 22627824f05dd0190e7c42290035289b08609c17..ab28b2fd257cdfaefe3201b55160f7d9c9135f46 100644 (file)
@@ -66,6 +66,7 @@ static void *dp_alloc(size_t sz)
                return NULL;
        }
 
+       memset(buf, 0, sz);
        return buf;
 }